package action.query;

import java.util.List;

import service.QueryService;

import com.opensymphony.xwork2.ActionSupport;

public class QueryAction extends ActionSupport {
	private String name;
	private int type;
	private QueryService queryService;
	private List result;
	
	@Override
	public String execute() throws Exception {
		switch(type){
		case 1:
			result=queryService.queryUsersByName(name);
			return "user";
		case 2:
			result=queryService.queryArticlesByName(name);
			return "article";
		case 3:
			result=queryService.queryAlbumsByName(name);
			return "album";
		}
		return SUCCESS;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public QueryService getQueryService() {
		return queryService;
	}

	public void setQueryService(QueryService queryService) {
		this.queryService = queryService;
	}

	public List getResult() {
		return result;
	}

	public void setResult(List result) {
		this.result = result;
	}
	
	
}
